package com.tegistuff.webos.run.debugger.commands;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * WebOSGetStackTraceCommand.java
 *
 * Copyright (C) 2011-2012 Timo Tegtmeier.
 * All rights reserved.
 */
public class WebOSGetStackTraceCommand extends WebOSDebuggerCommand {

    private JSONObject myStacktrace;
    private JSONArray myVariables;

    @Override
    public void execute() throws JSONException {
        runRequest(ourAppDebugSession.getBacktraceRequest());
    }

    @Override
    protected void onSuccess() throws JSONException {
        myStacktrace = ourResponse.getJSONObject("body");
        myVariables = ourResponse.getJSONArray("refs");
    }

    public JSONObject getStackTrace() {
        return myStacktrace;
    }
    
    public JSONArray getVariables() {
        return myVariables;
    }
}
